package com.pth.admin.action;

import com.opensymphony.xwork2.ActionSupport;
import com.pth.model.Knowledge;
import com.pth.service.KnowledgeService;

@SuppressWarnings("serial")
public class KnowledgeAllAction extends ActionSupport {

	private int id;
	
	private KnowledgeService knowledgeService;
	
	private Knowledge knowledge;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public KnowledgeService getKnowledgeService() {
		return knowledgeService;
	}

	public void setKnowledgeService(KnowledgeService knowledgeService) {
		this.knowledgeService = knowledgeService;
	}

	public Knowledge getKnowledge() {
		return knowledge;
	}

	public void setKnowledge(Knowledge knowledge) {
		this.knowledge = knowledge;
	}
	
	
	public String delete() throws Exception{
		
		Knowledge k=knowledgeService.getKnowledgeByid(id);
		
		knowledgeService.delete(k);
		
		return "delete";
	}
	
	
	public String modify() throws Exception{
		
		knowledgeService.modify(knowledge);
		
		return "modify";
	}
	
}
